package controler.userCommands;
import controler.A_State;
import controler.A_UserCommand;

/**
 * @author Damien Mabin
 */

class MoveElement<T> extends A_UserCommand
{

	var m_ElementToMove	: T;
	var m_Class			: Class<T>;
	var m_X				: Float;
	var m_Y				: Float;
	var m_Z				: Float;
	
	public function new(_NextModelState:A_State, _Class:Class<T>, _Elt:T, _X:Float, _Y:Float, _Z:Float) 
	{
		super(_NextModelState);
		m_CanBeUndo = true;
		m_ElementToMove = _Elt;
		m_Class = _Class;
		m_X = _X;
		m_Y = _Y;
		m_Z = _Z;
		
	}
	
	override public function DoCommand():Void 
	{
		super.DoCommand();
		A_UserCommand.s_Model.CTRL_MoveElement(m_Class, m_ElementToMove, m_X, m_Y, m_Z);
	}
	
	override public function UndoCommand():Void 
	{
		A_UserCommand.s_Model.CTRL_MoveElement(m_Class, m_ElementToMove, -m_X, -m_Y, -m_Z);
		super.UndoCommand();
	}
	
}